package com.gitee.xhs.savePointReader.keyedState.aggregatingStateReader;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author BigHead
 * @date 2022/6/30 15:17
 * @description AggregatingStateExhibitor
 */
public class AggregatingStateExhibitor {

    private String jobId;

    private String operatorUid;

    private Long key;

    private Map<Double, Integer> aggregatingStateValue;

    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public String getOperatorUid() {
        return operatorUid;
    }

    public void setOperatorUid(String operatorUid) {
        this.operatorUid = operatorUid;
    }

    public Long getKey() {
        return key;
    }

    public void setKey(Long key) {
        this.key = key;
    }

    public Map<Double, Integer> getAggregatingStateValue() {
        return aggregatingStateValue;
    }

    public void setAggregatingStateValue(Map<Double, Integer> aggregatingStateValue) {
        this.aggregatingStateValue = aggregatingStateValue;
    }

    @Override
    public String toString() {
        List<String> aggregatingStringList = new ArrayList<>();
        for (Map.Entry<Double, Integer> mapEntry : aggregatingStateValue.entrySet()) {
            aggregatingStringList.add(
                    mapEntry.getKey() + " ->" + mapEntry.getValue()
            );
        }
        return "AggregatingStateExhibitor{" +
                "jobId='" + jobId + '\'' +
                ", operatorUid='" + operatorUid + '\'' +
                ", key=" + key +
                ", aggregatingStateValue='" + String.join("|", aggregatingStringList) + "'" +
                '}';
    }
}
